package com.come4loves.game.module.skill.skillcardimpl;

import org.springframework.stereotype.Component;

import com.come4loves.game.module.fight.action.AttributeChangeAction;
import com.come4loves.game.module.fight.action.BatchAction;
import com.come4loves.game.module.fight.constants.FighterAttribute;
import com.come4loves.game.module.fight.model.FightCard;
import com.come4loves.game.module.fight.model.FightContext;
import com.come4loves.game.module.skill.AbstractSkillCardParser;
import com.come4loves.game.module.skill.model.SkillModel;
@Component
public class DurabilityLossSkill extends AbstractSkillCardParser {

	@Override
	public String skillId() {
		return "durabilityloss";
	}

	@Override
	public void handerSkill(FightCard attackerCard, FightCard targetCard, SkillModel skillModel, BatchAction batchAction, FightContext fightContext) {
		if (targetCard.isDead()) {
			return;
		}
		int effectValue = Integer.valueOf(skillModel.getEffect().get(skillId()));
		targetCard.setHp(targetCard.getHp() - effectValue);
		AttributeChangeAction attributeChangeAction = new AttributeChangeAction(targetCard);
		attributeChangeAction.addAttributeChange(FighterAttribute.HP, effectValue, false);
		batchAction.addAction(attributeChangeAction);
	}

}
